
import 'package:school_safe_teacher/me/entity/userEntity.dart';
import 'package:school_safe_teacher/utils/sp_utils.dart';

import 'constants.dart';

class AllInfo {
  // 工厂模式
  factory AllInfo() => _getInstance();

  static AllInfo get instance => _getInstance();
  static AllInfo _instance;

  AllInfo._internal() {
    // 初始化
   //_baiduLocation = BaiduLocation();
  }

  static AllInfo _getInstance() {
    if (_instance == null) {
      _instance = new AllInfo._internal();
    }
    return _instance;
  }

  String _token;
  String get token=>_token;
  void setToken(String token){
    _token = token;
    SpUtil.setStringItem(Constants.accessToken, token);
  }

  String _userInfo;
  String  get userinfo=>_userInfo;
  void setUserinfo(String userinfo){
    _userInfo = userinfo;
    SpUtil.setStringItem(Constants.SP_USER, userinfo);
  }

  UserEntity _userEntity;
  UserEntity get userEntity => _userEntity;
  void setUserEntity(UserEntity userEntity){
    _userEntity = userEntity;
  }
  String _phone;

  String get phone => _phone;

  void setPhone(String phone) {
    _phone = phone;
    SpUtil.setStringItem(Constants.phone, phone);
  }

  String _classID;
  String get classID=>_classID;
  void setclassID(String classID) {
    _classID = classID;
    SpUtil.setStringItem(Constants.classID, classID);
  }
  // String _city;
  //
  // String get city => _city;
  //
  // String _tel;
  // String get tel =>_tel;
  // void setTel(String tel){
  //   _tel = tel;
  // }
  //
  // void setCity(String city){
  //   _city = city;
  //   SpUtil.setStringItem(Constants.CITY, city);
  // }
  //
  double _ScreenWith;

  double get ScreenWith => _ScreenWith;

  void setScreenWith(double ScreenWith) {
    _ScreenWith = ScreenWith;
  }
  // String _level;
  //
  // String get level => _level;
  //
  // void setLevel(String level) {
  //   _level = level;
  // }
  //
  // AppDatabase _database;
  //
  // AppDatabase get database => _database;
  //
  // void setDataBase(AppDatabase database) {
  //   _database = database;
  // }
  //
  // LoginUserEntity _loginUserEntity;
  //
  // LoginUserEntity get loginUserEntity => _loginUserEntity;
  //
  // void setLoginUserEntity(LoginUserEntity loginUserEntity) {
  //   _loginUserEntity = loginUserEntity;
  // }
  //
  // BaiduLocation _baiduLocation;
  //
  // BaiduLocation get baiduLocation => _baiduLocation;
  //
  // Future<void> setBaiduLocation(BaiduLocation value) async {
  //   _baiduLocation = value;
  //   String city = await SpUtil.getStringItem(Constants.CITY);
  //   if (null == city || city.isEmpty || value.city.contains(city)) {
  //     setCity(value.city);
  //   } else {
  //     setCity(city);
  //   }
  // }
}
